import { Notification } from 'element-ui'


let baseUrl = ''
export default async(url, method, data = {}, forbid) => {
  url = baseUrl + url
  let response

  if (method == 'get') {
    response = await axios.get(url)
  } else if (method == 'post') {
    response = await axios.post(url, data)
  }

  if (response.data.code !== 200) {
    Notification.error({
      message: response.data.error,
      duration: 1500
    })
  }
  return Promise.resolve(response.data)

}